package objects;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 *
 * @author Bartek & Marcin
 */
public abstract class TimeManager {
    private static List<Long> Checktimes = new ArrayList<>();
    private static List<Integer> Intervals = new ArrayList<>();
    private static long curr_time;
    private static int list_ptr = 0;
    private static Boolean isPaused = false;
    
    public static Boolean check(int ID){
        curr_time = new Date().getTime();
        if(((curr_time - Checktimes.get(ID)) > Intervals.get(ID))&&(!isPaused)){
            Checktimes.set(ID, curr_time);
            return true;
        }
        return false;
    }
    public static int register(int interval){
        Checktimes.add(new Long(0));
        Intervals.add(interval);
        list_ptr++;
        return list_ptr-1;
    }
    public static void pause(){
        isPaused = true;
    }
    public static void play(){
        isPaused = false;
        
    }
    public static Boolean isPaused(){
        return isPaused;
    }
}
